import request from '@/utils/request'

// 查询
export function GetmonitorList(data) {
  if (data.baseName == '' && data.regionName == '') {
    return request({
      url: `/videoMonitor/query?limit=${data.limit}&page=${data.page}&keyword=${data.keyword}`,
      method: 'get'
    })
  }
  if (data.baseName == '' && data.regionName != '') {
    return request({
      url: `/videoMonitor/query?regionName=${data.regionName}&limit=${data.limit}&page=${data.page}&keyword=${data.keyword}`,
      method: 'get'
    })
  }
  if (data.baseName != '' && data.regionName == '') {
    return request({
      url: `/videoMonitor/query?baseName=${data.baseName}&limit=${data.limit}&page=${data.page}&keyword=${data.keyword}`,
      method: 'get'
    })
  }
  if (data.baseName != '' && data.regionName != '') {
    return request({
      url: `/videoMonitor/query?baseName=${data.baseName}&regionName=${data.gradeName}&limit=${data.limit}&page=${data.page}&keyword=${data.keyword}`,
      method: 'get'
    })
  }
}

// 新增
export function addmonitorList(data) {
  return request({
    url: '/videoMonitor/insert',
    method: 'post',
    data
  })
}

// 删除
export function deletemonitorList(data) {
  return request({
    url: `/videoMonitor/delete/${data.videoMonitorId}`,
    method: 'delete'
  })
}

// 批量删除
export function deletemonitorLists(data) {
  return request({
    url: `/videoMonitor/deletes?ids%5B%5D=${data.item}`,
    method: 'delete'
  })
}

// 更新
export function updatemonitorList(data) {
  return request({
    url: '/videoMonitor/update',
    method: 'put',
    data
  })
}

// 导入
export function uploadmonitorList(data) {
  return request({
    url: `/videoMonitor/uploadFile`,
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: data
  })
}
